﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenNI;

namespace CCT.NUI.Core.OpenNI
{
    public class GeneratorAdapterBase<TGenerator>
        where TGenerator : Generator
    {
        public GeneratorAdapterBase(TGenerator generator)
        {
            this.Generator = generator;
        }

        protected TGenerator Generator { get; private set; }

        public void Start()
        {
            this.Generator.StartGenerating();
        }

        public void Stop()
        {
            this.Generator.StopGenerating();
        }

        public void WaitAndUpdateData()
        {
            try
            {                
                this.Generator.WaitAndUpdateData();
            }
            catch (StatusException) { }
        }
    }
}
